package com.funong.matrix.biz.base.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.funong.matrix.biz.base.entity.SysUserEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * @author wanjialin
 * @version 1.0
 * @date 2023/5/18
 */
public interface SysUserMapper extends BaseMapper<SysUserEntity> {


    /**
     * 根据权限编码获取用户数据信息
     * @param permissionCode
     * @return
     */
    @Select("SELECT u.* FROM sys_user u,sys_role_user r,sys_role_permission p WHERE " +
            " u.id = r.user_id AND r.role_code = p.role_code  AND p.is_deleted = 0 AND p.permission_code = #{permissionCode} ")
    List<SysUserEntity> queryUserByPermission(@Param("permissionCode") String permissionCode);
}
